#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   sku2_common_variable.py
@Contact :   pengwei.sun@aihuishou.com
@License :   (C)Copyright aihuishou

@Modify Time      @Author       @Version    @Desciption
------------      -----------   --------    -----------
2021-08-12 18:06   pengwei.sun      1.0         None
'''

insert_mysql_columns = ['date', 'product_category_id', 'product_category_name', 'product_brand_id',
                        'product_brand_name', 'product_key', 'product_name', 'product_sku_name', 'product_sku_key',
                        'product_level_name', 'level_sub', 'template_rank', 'rank', 'product_level_key',
                        'predict_origin', 'process_price_res', 'process_price_inverse_begin',
                        'process_price_last', 'process_price', 'thisprice', 'saleprice', 'final_price',
                        'forecast_reference_price', 'price_0_7', 'sale_num_0_7', 'price_8_14',
                        'sale_num_8_14', 'price_15_21', 'sale_num_15_21', 'price_22_42', 'sale_num_22_42', 'count',
                        'price_3', 'price_2', 'price_1', 'qty', 'mean_rate', 'reverse', 'reverse_cnt',
                        'sku_e_level_min_rank', 'sku_level_max_price',
                        'sku_e_level_min_price', 'limit_flag', 'limit_rate', 'concat_leve_rank', 'level_limit_cnt',
                        'limit_max_rate', 'limit_min_rate', 'product_level_name_a2',
                        'a2_price', 'y_pred', 'purchase_channel_name', 'purchase_flag'
                        ]

COLUMNS_RANK_LIST = ['storage_rank', 'memory_rank', 'networks_rank', 'purchase_way_rank', 'guarantee_rank',
                     'small_model_rank']
COLUMNS_RANK_COLUMN_LIST = ['warranty_duration_name', 'color_name', 'network_standard_name', 'memory_capacity_name',
                            'memory_name', 'small_model_name', 'purchase_channel_name']

QUERY_SKU_COLUMN_RANK_SQL = """
            select distinct
            a.product_sku_id as product_sku_key,a.storage_id,a.guarantee_id,a.memory_id,a.networks_id,a.purchase_way_id,
            b.rank as storage_rank,c.rank as memory_rank 
            ,d.rank as networks_rank ,e.rank as purchase_way_rank ,f.rank as guarantee_rank ,g.rank as small_model_rank ,
            warranty_duration_name,color_name,network_standard_name,memory_capacity_name,memory_name,small_model_name,purchase_channel_name
             from dim_product_sku a
            left join sku_property_rank b on 
            a.storage_id=b.property_value_id
            left join sku_property_rank c on 
            a.memory_id=c.property_value_id
            left join sku_property_rank d on 
            a.networks_id=d.property_value_id
            left join sku_property_rank e on 
            a.purchase_way_id=e.property_value_id
            left join sku_property_rank f on 
            a.guarantee_id=f.property_value_id
            left join sku_property_rank g on 
            a.small_model_id=g.property_value_id
 where category_id=1
"""
FILE_DIR = 'file/'

